/**
 * Created with IntelliJ IDEA.
 * Description:
 * Date: 2023-05-12
 * Time: 10:18
 */
class Animal{
    public String name;
    public int age;

    public void eat(){
        System.out.println(name+" 正在吃饭！");
    }
}
class Dog extends Animal{
    public void wangwang(){
        System.out.println(name+" 正在汪汪叫！");
    }

    /*@Override
    public void eat() {
        super.eat();
    }*/
    @Override
    public void eat(){
        System.out.println(name+" 正在吃狗粮！");
    }
}
class Bird extends Animal{
    public String wing;//翅膀
    public void fly(){
        System.out.println(name+" 正在飞！");
    }
    @Override
    public void eat(){
        System.out.println(name+" 正在吃鸟粮！");
    }
}
public class Test2 {
    public static void function(Animal animal){
        animal.eat();
    }
    public static void main(String[] args) {
        Animal animal1 = new Dog();
        animal1.name = "小黄";
        function(animal1);
        //animal1.eat();
        //animal1.wangwang();

        System.out.println("=================");
        Animal animal2 = new Bird();
        animal2.name = "圆圆";
        function(animal2);
        //animal2.eat();
    }
    /*public static void func(Animal animal){
    }*/
    public static Animal func2(){
        return new Dog();
    }

    public static void main2(String[] args) {
        //Dog dog = new Dog();
        //func2();
    }

    public static void main1(String[] args) {
        Dog dog = new Dog();
        dog.name = "小黄";
        dog.eat();
        dog.wangwang();

        Animal animal = dog;

        Bird bird = new Bird();
        bird.name = "圆圆";
        Animal animal2 = bird;
        System.out.println("1111");
    }
}
